<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>创建新元素</title>
<script>
window.onload = function() {
  var newDiv = document.createElement("div");

  var textNode = document.createTextNode("Hello World!");

  newDiv.appendChild(textNode);

  document.body.appendChild(newDiv);
};
</script>
</head>
<body>

</body>
</html>